<template>
    <div>
      <a-spin :spinning='loading' tip=" 正在加载数据，请耐心等待">
        <a-table
          ref='table'
          size='middle'
          bordered
          :rowKey="record => record.categoryId"
          childrenColumnName='childrenColumnName'
          :columns='columns'
          :dataSource='dataSource'
          :pagination="false"
        >
          <span slot='keyword' slot-scope='text, record'>
              <span v-if='text.children&&text.children.length===0'
                    style='margin-left: 5px;color: #ff0000;cursor: pointer'>暂无</span>
              <span v-else
                    v-for='(item,index) in text.children' :key='index'
                    style='margin-left: 5px;color: #3399ff;cursor: pointer'><span
                v-show='index!=0'>
              </span>{{ item.keyName }}</span>
          </span>
          <span slot='action' slot-scope='text, record,index'>
              <a @click='handleDel(record.qxId)'> 查看详情 </a>
          </span>
        </a-table>
      </a-spin>
    </div>
</template>

<script>
import EpaSortService from '@/myService/EpaSortService'

export default {
  name: 'Step3',
  props: ['startDate','endDate'],
  data() {
    return {
      visible:false,
      dataSource: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: (text, row, index) => 1 + index
        },
        {
          title: '污染小类',
          dataIndex: 'categoryName',
          align: 'center'
        },
        {
          title: '关键字',
          align: 'center',
          key: 'keyword',
          ellipsis: true,
          scopedSlots: { customRender: 'keyword' },
        },
        {
          title: '工单数',
          dataIndex: 'keyNum',
          align: 'center'
        },
        // {
        //   title: '操作',
        //   key: 'action',
        //   align: 'center',
        //   scopedSlots: { customRender: 'action' }
        // }
      ],
      data:{},
      loading:true
    }
  },
  mounted() {

  },
  created() {

  },
  methods:{
    getCategoryStatisticsAll(){
      console.log("step3")
      this.loading=true
      EpaSortService.getCategoryStatisticsAll({startDate:this.startDate,endDate:this.endDate}).then((res)=>{
        console.log(res)
        this.dataSource=res.result
      }).finally(
        ()=> {
          this.loading = false;
        }
      )
    },
  }

}
</script>

<style scoped>

</style>